#2022年省赛-程序设计题 推导部分和
def find(x):
    if x != parent[x]:
        parent[x] = find(parent[x])
    return parent[x]


def union(x, y):
    x_root = find(x)
    y_root = find(y)
    if x_root == y_root:
        return False
    parent[x_root] = y_root
    return True

def dfs(i, j):
  flag[i] = False
  total[i] = j
  for child, dis in g[i]:
    if flag[child]:
      dfs(child, j + dis)


n, m, q = list(map(int, input().split()))
parent = [i for i in range(n + 1)]
g = [[] for _ in range(n + 1)]  # 建图

for _ in range(m):
    l, r, s = list(map(int, input().split()))
    l = l - 1
    flag = union(l, r)
    if flag:   # 这样就不会构造出环
        g[l].append([r, s])
        g[r].append([l, -s])

total = [0] * (n + 1)
flag = [True] * (n + 1)
for i in range(n + 1):
  if flag[i]:  # 表示当前的 节点 i 没有访问过
    dfs(i, 0)

for _ in range(q):
    l, r = list(map(int, input().split()))
    l = l - 1
    if find(l) != find(r):
        print('UNKNOWN')
    else:
        print(total[r] - total[l])
